<?php

namespace Tbf\Bundle\TestBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;
use Symfony\Component\Config\Definition\ScalarNode;

/**
 * This is the class that validates and merges configuration from your app/config files
 *
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
 */
class Configuration implements ConfigurationInterface
{
    /**
     * {@inheritDoc}
     */
    public function getConfigTreeBuilder()
    {
        $treeBuilder = new TreeBuilder();
        $rootNode = $treeBuilder->root('tbf_test');

        // Here you should define the parameters that are allowed to
        // configure your bundle. See the documentation linked above for
        // more information on that topic.
        $default_host = 'http://127.0.0.1/';
        $default_ajax_client_config = array(
            'curl.options'=> array(
                'CURLOPT_PROXY'=>'',//不要用代理
                'CURLOPT_USERPWD'=>''//http普通密码  user:password
            )
        );
        $rootNode
            ->children()
                ->scalarNode('is_real_http')->defaultFalse()->end()
                ->scalarNode('host')->defaultValue($default_host)->end()
                ->variableNode('ajax_client_config')
                    ->defaultValue($default_ajax_client_config)
                ->end()
            ->end();

        return $treeBuilder;
    }
}
